2 -- Slots represent an n:m relation between revisions and content objects.
3 -- A content object can have a specific "role" in one or more revisions.
4 -- Each revision can have multiple content objects, each having a different role.
6 CREATE TABLE /*_*/slots (
9 slot_revision_id
bigint unsigned
NOT NULL,
11 -- reference to role_id
12 slot_role_id
smallint unsigned
NOT NULL CONSTRAINT FK_slots_slot_role
FOREIGN KEY REFERENCES slot_roles(role_id
),
14 -- reference to content_id
15 slot_content_id
bigint unsigned
NOT NULL CONSTRAINT FK_slots_content_id
FOREIGN KEY REFERENCES content(content_id
),
17 -- whether the content is inherited (1) or new in this revision (0)
18 slot_inherited tinyint unsigned
NOT NULL CONSTRAINT DF_slot_inherited
DEFAULT 0,
20 CONSTRAINT PK_slots
PRIMARY KEY (slot_revision_id
, slot_role_id
)
23 -- Index for finding revisions that modified a specific slot
24 CREATE INDEX /*i*/slot_role_inherited
ON /*_*/slots (slot_revision_id
, slot_role_id
, slot_inherited
);